<template>
  <div class="album">
    <router-link
      :to="{ path: '/album', query: { id: item.id } }"
      v-for="item in ablumList"
      :key="item.id"
      class="item"
    >
      <div class="faceImg">
        <el-image :src="item.picUrl" lazy>
          <div slot="placeholder" class="image-slot">
            <i class="iconfont icon-placeholder"></i>
          </div>
        </el-image>
      </div>
      <div class="info">
        <div class="album-type">{{ item.type }}</div>
        <div class="album-name">{{ item.name }}</div>
        <div class="artist-name">{{ item.artist.name }}</div>
      </div>
    </router-link>
  </div>
</template>

<script>
export default {
  name: "AblumList",
  props: ["ablumList"],
};
</script>

<style lang="less" scoped>
.album {
  display: flex;
  flex-wrap: wrap;
  flex-direction: row;
  justify-content: left;
  padding-bottom: 40px;
  margin: 0 -10px;
  .item {
    display: flex;
    flex: 30%;
    max-width: calc(100% / 3 - 20px);
    margin: 20px 10px 0;
    border-radius: 4px;
    background: #f0f0f0;
    &:hover {
      .album-name {
        color: #ff641e;
      }
    }
  }
  .faceImg {
    display: block;
    position: relative;
    width: 120px;
    height: 120px;

    &::after {
      display: inline-block;
      position: absolute;
      width: 100%;
      height: 100%;
      top: 0;
      right: -20px;
      content: "";
      background: url("../../assets/disc.png") no-repeat;
      background-size: contain;
      transition: all 0.4s linear;
    }
    &:hover {
      &::after {
        right: -25px;
        transform: rotate(90deg);
      }
    }
  }
  .el-image {
    border-radius: 4px;
    z-index: 2;
    position: relative;
  }
  .info {
    position: relative;
    flex: 1;
    margin-left: 40px;
    overflow: hidden;
    .album-name {
      padding: 30px 15px 10px 0;
      font-size: 16px;
      color: #333;
      word-break: break-all;
    }
    .artist-name {
      font-size: 14px;
      color: #999;
    }
    .album-type {
      position: absolute;
      top: 5px;
      right: -30px;
      width: 100px;
      font-size: 12px;
      line-height: 24px;
      text-align: center;
      transform: rotate(45deg);
      color: #fff;
      background-color: #ff641e;
    }
  }
}
</style>
